package com.usian.user.feign;

import com.github.pagehelper.PageInfo;
import com.usian.common.dto.CompeDto;
import com.usian.common.dto.CompetitionDto;
import com.usian.common.pojo.Compe;
import com.usian.common.pojo.Que;
import com.usian.common.pojo.Question;
import com.usian.common.pojo.Team;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "day12-mapenghui-compe")
public interface CompetitionFeign {

    @GetMapping("/compe/getCompetitionCounts/{userId}")
    Compe getCompetitionCounts(@PathVariable(value = "userId") Integer userId);

    @PostMapping("/compe/getCompetitionList")
    PageInfo<Compe> getCompetitionList(@RequestBody CompetitionDto competitionDto);

    @GetMapping("/compe/getCompetitionById")
    Compe getCompetitionById(@RequestParam("compeId") Integer compeId);

    @GetMapping("/compe/addMember")
    Boolean addMember(@RequestParam("compeId") Integer compeId, @RequestParam("userId") Integer userId);

    @GetMapping("/compe/getTeam")
    List<Team> getTeam();

    @GetMapping("/compe/startCompe")
    Compe startCompe(@RequestParam("compeId") Integer compeId);

    @GetMapping("/compe/insertHistory")
    void insertHistory(@RequestParam("compeId")Integer compeId, @RequestParam("queId")Integer queId, @RequestParam("answerId")Integer answerId);

    @GetMapping("/compe/selectAnswerById")
    Integer selectAnswerById(@RequestParam("compeId")Integer compeId, @RequestParam("queId")Integer queId);

    @GetMapping("/compe/getQue")
    Que getQue(@RequestParam("compeId")Integer compeId, @RequestParam("queId")Integer queId);

    @PostMapping("/compe/getCompeResult")
    Compe getCompeResult(@RequestBody CompeDto compeDto);

    @GetMapping("/compe/judgeAnswer")
    List<Question> judgeAnswer(@RequestParam("compeId") Integer compeId);
}
